package com.itqf.controller;

import com.itqf.dto.SearchDto;
import com.itqf.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * projectName: springmvcgp8
 *
 * @author: 赵伟风
 * time: 2021/8/9 17:43
 * description:
 */
@RequestMapping("bill")
@RestController
@CrossOrigin("*")
public class BillController {


    @Autowired
    private BillService billService;

    /**
     * dto controller -- service 的传递对象
     *
     * vo  我们返回给前端的视图对象
     *
     * pojo
     */
    @PostMapping(value = "search",consumes = "application/json;charset=utf-8",produces = "application/json;charset=utf-8")
    public Object  search(@RequestBody SearchDto searchDto){

        //info
        //debug : 输出不确定的,可能出现问题的参数 / 服务调用 searchDto

        System.out.println("searchDto = " + searchDto);

        Map<String, Object> search = billService.search(searchDto);

        System.out.println("search = " + search);


        //info

        return search;
    }


    @GetMapping("remove")
    public Object remove(int id){

        Map<String, Object> data =   billService.remove(id);

        return data;
    }


}
